<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:69:"D:\wamp\www\shop\public/../application/madmin\view\Group\showAdd.html";i:1547521112;s:71:"D:\wamp\www\shop\public/../application/madmin\view\Public\showBase.html";i:1547543098;}*/ ?>
<!DOCTYPE HTML>
<html>
	<head>
		<title>后台管理</title>
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <meta charset="UTF-8" />
	    <link rel="icon" type="image/ico" href="__IMG__/favicon.ico" />
	    <link type="text/css" rel="stylesheet" href="__CSS__/vendor/bootstrap/bootstrap.min.css" />
	    <link type="text/css" rel="stylesheet" href="__CSS__/content.css" />
		<link type="text/css" rel="stylesheet" href="__CSS__/vendor/font-awesome.css" />
		<link type="text/css" rel="stylesheet" href="__CSS__/vendor/bootstrap-checkbox.css" />
		<link type="text/css" rel="stylesheet" href="__JS__/vendor/chosen/css/chosen.min.css" />
		<link type="text/css" rel="stylesheet" href="__JS__/vendor/chosen/css/chosen-bootstrap.css" />
		<link type="text/css" rel="stylesheet" href="__CSS__/nicescroll.css" />
        <link type="text/css" rel="stylesheet" href="__CSS__/adapt.css" />
        <link type="text/css" rel="stylesheet" href="__CSS__/pagination.css" />
        <link type="text/css" rel="stylesheet" href="__CSS__/buttons.css" />
		<script type="text/javascript" src="__JS__/jquery-3.3.1.min.js"></script>
		<script type="text/javascript" src="__JS__/vendor/layer/layer.js"></script>
		<script type="text/javascript" src="__JS__/vendor/bootstrap/bootstrap.min.js"></script>
		<script type="text/javascript" src="__JS__/vendor/nicescroll/jquery.nicescroll.min.js"></script>
		<script type="text/javascript" src="__JS__/vendor/chosen/chosen.jquery.min.js"></script>
		<script type="text/javascript" src="__JS__/content.js"></script>
	</head>
	<body class="no-bg">
		<div id="wrap">
	        <div class="row">
	            <div id="content" class="col-md-12">
	            	
<div class="main">
    <div class="row">
        <div class="col-md-12">
            <section class="tile color transparent-black">
                <div class="tile-header bg-transparent-black-2">
                    <h1>
                        <?php if($Info == ''): ?>
                            <?php echo lang('Group_Add'); else: ?>
                            <?php echo lang('Group_Edit'); endif; ?>
                    </h1>
                    <div class="controls">
                        <a href="javascript:void(0);" onclick="window.history.back();"><i class="fa fa-arrow-left"></i></a>
                        <?php if($Info == ''): ?>
                            <a href="<?php echo url('Group/showAdd'); ?>"><i class="fa fa-refresh"></i></a>
                        <?php else: ?>
                            <a href="<?php echo url('Group/showEdit', array('id'=>$Info['group_id'])); ?>"><i class="fa fa-refresh"></i></a>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="tile-body nopadding">
                    <form class="FormTable" action="" method="post">
                        <div class="tile-body">
                            <div class="row">
                                <div class="form-group col-sm-12">
                                    <label><?php echo lang('Group_Title'); ?></label>
                                    <input type="text" class="form-control" name="group_title" value="<?php echo $Info['group_title']; ?>" placeholder="<?php echo lang('Group_Title_Empty'); ?>" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label><?php echo lang('Group_Rules'); ?></label>
                                    <?php if(is_array($Rule) || $Rule instanceof \think\Collection || $Rule instanceof \think\Paginator): $i = 0; $__LIST__ = $Rule;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$Pid1): $mod = ($i % 2 );++$i;?>
                                        <div class="Check11" style="clear: both;">
                                            <div class="checkbox check-transparent">
                                                <input class="checkboxs Check1" type="checkbox" name="group_rules[]" value="<?php echo $Pid1['rule_id']; ?>" id="opt<?php echo $Pid1['rule_id']; ?>" />
                                                <label for="opt<?php echo $Pid1['rule_id']; ?>"><?php echo $Pid1['rule_title']; ?></label>
                                            </div>
                                            <?php if(is_array($Pid1['rule_child']) || $Pid1['rule_child'] instanceof \think\Collection || $Pid1['rule_child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $Pid1['rule_child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$Pid2): $mod = ($i % 2 );++$i;?>
                                                <div class="Check22" style="clear: both;">
                                                    <div class="checkbox check-transparent" style="margin-left: 22px">
                                                        <input class="checkboxs Check2" type="checkbox" name="group_rules[]" value="<?php echo $Pid2['rule_id']; ?>" id="opt<?php echo $Pid2['rule_id']; ?>" />
                                                        <label for="opt<?php echo $Pid2['rule_id']; ?>"><?php echo $Pid2['rule_title']; ?></label>
                                                    </div>
                                                    <?php if(is_array($Pid2['rule_child']) || $Pid2['rule_child'] instanceof \think\Collection || $Pid2['rule_child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $Pid2['rule_child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$Pid3): $mod = ($i % 2 );++$i;?>
                                                        <div class="Check33" style="clear: both;">
                                                            <div class="checkbox check-transparent" style="margin-left: 44px">
                                                                <input class="checkboxs Check3" type="checkbox" name="group_rules[]" value="<?php echo $Pid3['rule_id']; ?>" id="opt<?php echo $Pid3['rule_id']; ?>" />
                                                                <label for="opt<?php echo $Pid3['rule_id']; ?>"><?php echo $Pid3['rule_title']; ?></label>
                                                            </div>
                                                            <?php if(is_array($Pid3['rule_child']) || $Pid3['rule_child'] instanceof \think\Collection || $Pid3['rule_child'] instanceof \think\Paginator): $key = 0; $__LIST__ = $Pid3['rule_child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$Pid4): $mod = ($key % 2 );++$key;?>
                                                                <div class="checkbox check-transparent" style="float: left;<?php if($key == 1): ?>margin-left: 66px;<?php endif; ?>">
                                                                    <input class="checkboxs" type="checkbox" name="group_rules[]" value="<?php echo $Pid4['rule_id']; ?>" id="opt<?php echo $Pid4['rule_id']; ?>" />
                                                                    <label for="opt<?php echo $Pid4['rule_id']; ?>"><?php echo $Pid4['rule_title']; ?></label>
                                                                </div>
                                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                                        </div>
                                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                                </div>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </div>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </div>
                                <div class="form-group col-sm-12" style="clear: both;">
                                    <label><?php echo lang('Group_State'); ?></label>
                                    <select class="chosen-select chosen-transparent form-control" name="group_state">
                                        <option value="1" <?php if($Info['group_state'] == '1'): ?>selected<?php endif; ?>><?php echo lang('Group_State_1'); ?></option>
                                        <option value="2" <?php if($Info['group_state'] == '2'): ?>selected<?php endif; ?>><?php echo lang('Group_State_2'); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                    <div class="row">
                        <div class="col-sm-12 text-center">
                            <button type="button" class="btn btn-<?php echo config('CNF_BTNCOLOR'); ?> ajax-post"><?php echo lang('Form_Submit'); ?></button>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>

	        	</div>
	        </div>
	    </div>
		
    <script>
        +function($){
            var rules = [<?php echo $Info['group_rules']; ?>];
            $('.checkboxs').each(function(){
                if($.inArray(parseInt(this.value),rules) > -1){
                    $(this).prop('checked',true);
                }
                if(this.value==''){
                    $(this).closest('.checkbox').remove();
                }
            });

            $('.Check1').on('change',function(){
                $(this).closest('.Check11').find('.checkbox').find('input').prop('checked',this.checked);
            });
            $('.Check2').on('change',function(){
                $(this).closest('.Check22').find('.checkbox').find('input').prop('checked',this.checked);
            });
            $('.Check3').on('change',function(){
                $(this).closest('.Check33').find('.checkbox').find('input').prop('checked',this.checked);
            });
        }(jQuery);
    </script>

	</body>
</html>